# 推导

# 列表推导
lst = [x * x for x in range(10)]
print(lst)  # [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

lst = [x for x in range(10) if x % 3 == 0]
print(lst)  # [0, 3, 6, 9]

lst = [(x, y) for x in range(4) for y in range(2)]
print(lst)  # [(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1)]

# dict推导
seq = {i: "{} squared is {}".format(i, i ** 2) for i in range(3)}
print(seq)  # {0: '0 squared is 0', 1: '1 squared is 1', 2: '2 squared is 4'}

#